{namespace dce=ArminVieweg\Dce\ViewHelpers}<?php

$GLOBALS['TCA']['tt_content']['columns']['CType']['config']['items'][] = array(
	0 => 'LLL:EXT:dce/Resources/Private/Language/locallang_db.xml:tx_dce_domain_model_dce_long',
	1 => '--div--'
);

\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addTCAcolumns('tt_content', array(
<f:for each="{dceFieldsWithNewTcaColumns}" as="dceField">
	'{dceField.new_tca_field_name}' => array('label' => '', 'config' => array('type' => 'passthrough')),
</f:for>
));
<f:for each="{dceArray}" as="dce">
<f:if condition="{dce.hidden} == 0">
	///////////////////////////////////////////////////// {f:if(condition:"{dce.uid}", then:"uid: {dce.uid}", else:"identifier: {dce.identifier}")} ///
	<f:if condition="{dce:be.version.typo3(returnInt:'1')} < 7006000">
		<f:then>
\TYPO3\CMS\Extbase\Utility\ExtensionUtility::registerPlugin(
	'ArminVieweg.dce',
	'{f:if(condition:"{dce.uid}", then:"dceuid{dce.uid}", else:"dce_{dce.identifier}")}',
	'{dce.title -> dce:format.addcslashes()}',
	''
);
		</f:then>
		<f:else>
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addTcaSelectItem(
	'tt_content',
	'CType',
	array(
		'{dce.title -> dce:format.addcslashes()}',
		'{f:if(condition:"{dce.uid}", then:"dce_dceuid{dce.uid}", else:"dce_{dce.identifier}")}',
		'<f:if condition="{dce.hasCustomWizardIcon}"><f:then>ext-dce-dceuid{dce.uid}-customwizardicon</f:then><f:else>{dce:be.contentElementWizardIconPath()}{dce.wizard_icon}</f:else></f:if>'
	)
);
		</f:else>
	</f:if>

<f:if condition="{dce:be.version.typo3(returnInt:'1')} >= 7006000">
	<f:then>
		$GLOBALS['TCA']['tt_content']['ctrl']['typeicon_classes']['{f:if(condition:"{dce.uid}", then:"dce_dceuid{dce.uid}", else:"dce_{dce.identifier}")}'] =
		'<f:if condition="{dce.hasCustomWizardIcon}"><f:then>ext-dce-dceuid{dce.uid}-customwizardicon</f:then><f:else>{dce:be.contentElementWizardIconPath()}{dce.wizard_icon}</f:else></f:if>';
	</f:then>
	<f:else>
	</f:else>
</f:if>

$GLOBALS['TCA']['tt_content']['types']['list']['subtypes_addlist']['dce_{f:if(condition:"{dce.uid}", then:"dceuid{dce.uid}", else:"dce_{dce.identifier}")}'] = 'pi_flexform';
$GLOBALS['TCA']['tt_content']['columns']['pi_flexform']['config']['ds'][',dce_{f:if(condition:"{dce.uid}", then:"dceuid{dce.uid}", else:"dce_{dce.identifier}")}'] = '<dce:format.tiny><f:render partial="FlexFormsXML" arguments="{dce:dce}"></f:render></dce:format.tiny>';
$GLOBALS['TCA']['tt_content']['types']['dce_{f:if(condition:"{dce.uid}", then:"dceuid{dce.uid}", else:"dce_{dce.identifier}")}']['showitem'] = '<dce:format.tiny>
	--palette--;;dce_palette_{dce.uid}_head,
	--palette--;;dce_palette_{dce.uid},
	pi_flexform,
	<f:if condition="{dce.show_access_tab}">
		<f:if condition="{dce:be.version.typo3(returnInt:'1')} >= 7006000">
			<f:then>
				--div--;LLL:EXT:lang/locallang_tca.xlf:be_users.tabs.access,
				--palette--;LLL:EXT:lang/locallang_tca.xlf:pages.palettes.visibility;visibility,
				--palette--;LLL:EXT:lang/locallang_tca.xlf:be_users.tabs.access;access,
			</f:then>
			<f:else>
				--div--;LLL:EXT:cms/locallang_ttc.xml:tabs.access,
				--palette--;LLL:EXT:cms/locallang_ttc.xml:palette.visibility;visibility,
				--palette--;LLL:EXT:cms/locallang_ttc.xml:palette.access;access,
			</f:else>
		</f:if>
	</f:if>
	<f:if condition="{dce.show_category_tab}">
		--div--;LLL:EXT:lang/locallang_tca.xlf:sys_category.tabs.category,
		categories,
	</f:if>
	--div--;LLL:EXT:cms/locallang_ttc.xml:tabs.extended
</dce:format.tiny>';

	$GLOBALS['TCA']['tt_content']['palettes']['dce_palette_{dce.uid}_head']['canNotCollapse'] = true;
	$GLOBALS['TCA']['tt_content']['palettes']['dce_palette_{dce.uid}_head']['showitem'] = '<dce:format.tiny>
		CType
		<f:if condition="{dce.enable_container}">
			,tx_dce_new_container
		</f:if>
	</dce:format.tiny>';
<f:if condition="{dce.palette_fields}">
	$GLOBALS['TCA']['tt_content']['palettes']['dce_palette_{dce.uid}']['canNotCollapse'] = true;
	$GLOBALS['TCA']['tt_content']['palettes']['dce_palette_{dce.uid}']['showitem'] = '<dce:format.tiny>
	{dce.palette_fields}
	<f:if condition="{dce:be.extensionIsInstalled(key:'gridelements')}">
		,tx_gridelements_container,tx_gridelements_columns
	</f:if>
	</dce:format.tiny>';
</f:if>

</f:if>
</f:for>

// global definitions
$GLOBALS['TCA']['tt_content']['columns']['CType']['config']['items'][] = array(
	0 => 'LLL:EXT:dce/Resources/Private/Language/locallang_db.xml:tx_dce_domain_model_dce.miscellaneous',
	1 => '--div--'
);

\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addPageTSConfig('mod.wizards.newContentElement.wizardItems.dce.header = LLL:EXT:dce/Resources/Private/Language/locallang_db.xml:tx_dce_domain_model_dce_long');
